package com.example.collections;

import com.alibaba.fastjson.JSONObject;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author csp 2021-01-18
 */
public class CollectorsGroup {
    @Test
    public void test(){
        List<JSONObject> list = new ArrayList<>();
        Map<Object, List<JSONObject>> id =
                list.stream().collect(Collectors.groupingBy(json -> json.get("id")));
        System.out.println(id);
    }
}
